package com.whmskj.xjlhsc.mobie.equipmentManage.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.whmskj.xjlhbc.domain.DictionaryProcess;
import com.whmskj.xjlhbc.mapper.DictionaryProcessMapper;
import com.whmskj.xjlhsc.mobie.equipmentManage.service.DictionaryProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 张
 * @version 1.0
 */

@Service
public class DictionaryProcessServiceImpl extends ServiceImpl<DictionaryProcessMapper, DictionaryProcess> implements DictionaryProcessService {
    @Autowired
    private DictionaryProcessMapper dictionaryProcessMapper;
    /**
     * 获取工序
     * @return
     */
    @Override
    public List<DictionaryProcess> process() {
        LambdaQueryWrapper<DictionaryProcess> dictionaryProcessLambdaQueryWrapper = new LambdaQueryWrapper<>();
        dictionaryProcessLambdaQueryWrapper.eq(DictionaryProcess::getDictionaryEncoding,"SCMa-process");
        List<DictionaryProcess> dictionaryProcesses = dictionaryProcessMapper.selectList(dictionaryProcessLambdaQueryWrapper);
        List<DictionaryProcess> collect = dictionaryProcesses.stream().filter(dictionaryProcess -> !dictionaryProcess.getDictionaryName().equals("条卷") && !dictionaryProcess.getDictionaryName().equals("精梳")).toList();
        return collect;
    }

    @Override
    public List<DictionaryProcess> getStopCarReason(String reason) {
       return dictionaryProcessMapper.selectSCTCreason(reason);
    }

    @Override
    public List<DictionaryProcess> getAwardsAndSanctiReason(Integer type) {
      return dictionaryProcessMapper.selectAwardsAndSanctiReason(type);
    }
}
